package finn.movingheadtracker.gui;

import javax.swing.JPanel;

import com.github.sarxos.webcam.Webcam;
import com.github.sarxos.webcam.WebcamPanel;

import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;

import java.awt.Dimension;
import javax.swing.JComboBox;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.JTable;
import javax.swing.JLabel;
import javax.swing.JSeparator;
import java.awt.GridLayout;
import javax.swing.SwingConstants;
import java.awt.Component;

public class CameraviewTab extends JPanel{
	private JTable table;
	private JTable table_1;

	public CameraviewTab() {
		setLayout(new GridLayout(0, 2, 0, 0));
		
		JPanel leftCameraPanel = new JPanel();
		leftCameraPanel.add(new WebcamPanel(Webcam.getDefault()));
		add(leftCameraPanel);
		leftCameraPanel.setLayout(new GridLayout(1, 0, 0, 0));
		
		JPanel rightControlPanel = new JPanel();
		rightControlPanel.setAlignmentY(Component.TOP_ALIGNMENT);
		rightControlPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
		add(rightControlPanel);
		
		JSeparator separator = new JSeparator();
		
		JLabel lbLights = new JLabel("Movingheads");
		lbLights.setHorizontalAlignment(SwingConstants.TRAILING);
		
		table = new JTable();
		
		JLabel lblPattern = new JLabel("Pattern ausw\u00E4hlen");
		
		JSeparator separator_1 = new JSeparator();
		
		JComboBox comboBox = new JComboBox();
		
		JLabel lblMonitorLights = new JLabel("Monitor Lights");
		
		table_1 = new JTable();
		GroupLayout gl_rightControlPanel = new GroupLayout(rightControlPanel);
		gl_rightControlPanel.setHorizontalGroup(
			gl_rightControlPanel.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_rightControlPanel.createSequentialGroup()
					.addContainerGap()
					.addGroup(gl_rightControlPanel.createParallelGroup(Alignment.LEADING)
						.addGroup(gl_rightControlPanel.createSequentialGroup()
							.addComponent(lbLights)
							.addGap(258))
						.addGroup(Alignment.TRAILING, gl_rightControlPanel.createSequentialGroup()
							.addComponent(lblPattern)
							.addContainerGap(208, Short.MAX_VALUE))
						.addGroup(gl_rightControlPanel.createSequentialGroup()
							.addComponent(lblMonitorLights)
							.addContainerGap(276, Short.MAX_VALUE))
						.addGroup(gl_rightControlPanel.createSequentialGroup()
							.addGroup(gl_rightControlPanel.createParallelGroup(Alignment.TRAILING, false)
								.addComponent(table_1, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
								.addComponent(comboBox, Alignment.LEADING, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
								.addComponent(separator_1, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 312, Short.MAX_VALUE))
							.addContainerGap())
						.addGroup(gl_rightControlPanel.createSequentialGroup()
							.addComponent(table, GroupLayout.PREFERRED_SIZE, 320, GroupLayout.PREFERRED_SIZE)
							.addContainerGap(30, Short.MAX_VALUE))
						.addGroup(gl_rightControlPanel.createSequentialGroup()
							.addComponent(separator, GroupLayout.PREFERRED_SIZE, 320, GroupLayout.PREFERRED_SIZE)
							.addContainerGap(18, Short.MAX_VALUE))))
		);
		gl_rightControlPanel.setVerticalGroup(
			gl_rightControlPanel.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_rightControlPanel.createSequentialGroup()
					.addContainerGap()
					.addComponent(lbLights)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(separator, GroupLayout.PREFERRED_SIZE, 11, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(table, GroupLayout.DEFAULT_SIZE, 94, Short.MAX_VALUE)
					.addGap(18)
					.addComponent(lblPattern)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(separator_1, GroupLayout.PREFERRED_SIZE, 4, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(comboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(lblMonitorLights)
					.addGap(8)
					.addComponent(table_1, GroupLayout.DEFAULT_SIZE, 117, Short.MAX_VALUE)
					.addContainerGap())
		);
		rightControlPanel.setLayout(gl_rightControlPanel);
		Webcam cam = Webcam.getDefault();
		cam.setViewSize(new Dimension(640,360));
		// TODO Auto-generated constructor stub
	}
}
